//
//  RHLaunchVC.m
//  RuiHeAppApp
//
//  Created by Yan Chen on 2024/1/4.
//

#import "RHLaunchVC.h"

@interface RHLaunchVC ()

@end

@implementation RHLaunchVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = UIColor.whiteColor;
    UIImageView *lunch_bg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"kt_lunch_bg"]];
    lunch_bg.contentMode = UIViewContentModeScaleAspectFill;
    [self.view addSubview:lunch_bg];
    [lunch_bg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsZero);
    }];
    
    UIImageView *logoImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"lunch_logo"]];
    [self.view addSubview:logoImg];
    [logoImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_offset(kSafe_top+kScaleW(30));
        make.width.offset(kScaleW(196));
        make.height.offset(kScaleW(36));
        make.centerX.mas_offset(0);
    }];
    
    QMUILabel *tipLab = [[QMUILabel alloc]init];
    tipLab.textAlignment = NSTextAlignmentCenter;
    tipLab.text = @"让能源更智能".rh_localized;
    tipLab.font = kSYSTEMFONT(18);
    tipLab.textColor = kCOLOR_HEX(@"#171A1D");
    [self.view addSubview:tipLab];
    
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    QMUILabel *versionLab = [[QMUILabel alloc]init];
    versionLab.text = [NSString stringWithFormat:@"V %@",app_Version];
    versionLab.font = kSYSTEMFONT(10);
    versionLab.textColor = kCOLOR_HEX(@"000000");
    [self.view addSubview:versionLab];
    
    
    [versionLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_offset(0);
        make.bottom.mas_offset(kSafe_bottom>0?-kSafe_bottom:-15);
    }];
    
    [tipLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.right.mas_offset(-15);
        make.bottom.equalTo(versionLab.mas_top).offset(-10);
    }];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (self.beginAction) {
            self.beginAction();
        }
    });
    
}

-(void)dealloc
{
    NSLog(@"%s",__func__);
}

@end
